package com.gzzn.validate.support;

import com.gzzn.validate.internal.Rule;

/**
 * author : zdp（zdp118@gmail.com）
 * date   : 2014-3-6
 * IP v4校验器
 */
public class IPv4Validate extends ValidateWithRegex {

    /**
     *   IPv4address
     *
         dec-octet "." dec-octet "." dec-octet "." dec-octet

         (?: (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?) \.){3}  # dec-octet "." dec-octet "."
         (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)         # dec-octet "." dec-octet
     */
    static final String IPV4_REGEX = "(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";

    static final String messageT = "Please enter a validate IP address.";

    public IPv4Validate() {
        super(messageT,Rule.IPv4, IPV4_REGEX);
    }
}
